from django.db import models

t_direction_choices = (
    ('0', '买'),
    ('1', '卖'),
)
t_offsetflag_choices = (
    ('0', '开仓'),
    ('1', '平仓'),
)


# 策略表
class TStrategy(models.Model):
    StgID = models.IntegerField(
        db_column="StgID",
        primary_key=True,
        verbose_name="策略代码"
    )
    StgName = models.CharField(
        db_column="StgName",
        max_length=50,
        verbose_name="策略名称"
    )
    StgType = models.CharField(
        db_column="StgType",
        max_length=1,
        verbose_name="策略类型"
    )
    CreateTime = models.CharField(
        db_column="CreateTime",
        max_length=19,
        verbose_name="创建时间"
    )
    BackUpdateTime = models.CharField(
        db_column="BackUpdateTime",
        max_length=19,
        null=True,
        verbose_name="快速回测最后运行时间"
    )
    SimUpdateTime = models.CharField(
        db_column="SimUpdateTime",
        null=True,
        max_length=19,
        verbose_name="模拟最后运行时间"
    )
    BackTest = models.IntegerField(
        db_column="BackTest",
        verbose_name="快速回测次数"
    )
    Sim = models.IntegerField(
        db_column="Sim",
        verbose_name="模拟次数"
    )
    Status = models.CharField(
        db_column="Status",
        max_length=1,
        verbose_name="策略状态"
    )
    CopyStgID = models.IntegerField(
        db_column="CopyStgID",
        null=True,
        verbose_name="复制实盘的策略代码"
    )
    CustomerID = models.CharField(
        db_column="CustomerID",
        max_length=20,
        verbose_name="用户代码"
    )

    class Meta:
        db_table = 't_strategy'


